﻿<metro:Window x:Class="WoblaExplorer.Windows.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        xmlns:local="clr-namespace:WoblaExplorer.CustomCommands"
        xmlns:util="clr-namespace:WoblaExplorer.Util"
        xmlns:converters="clr-namespace:WoblaExplorer.Converters"
        xmlns:io="clr-namespace:System.IO;assembly=mscorlib"
        xmlns:metro="http://schemas.codeplex.com/elysium"
        xmlns:params="http://schemas.codeplex.com/elysium/params"
        xmlns:behaviours="clr-namespace:WoblaExplorer.Behaviours"
        Title="WoblaExplorer" Height="350" MinHeight="350" Width="525" MinWidth="525" Name="MainWindowX">
    <Window.CommandBindings>
        <CommandBinding Command="Backspace" Executed="BackspaceExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="Open" Executed="OpenCommandExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="BrowseForward" Executed="BrowseForwardExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ShowInExplorer" Executed="ShowInExplorerExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.Rename" Executed="RenameExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.CopyTo" Executed="CopyToExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.Remove" Executed="RemoveExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.Exit" Executed="ExitExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.AboutDialog" Executed="AboutDialogExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.PropertiesDialog" Executed="PropertiesDialogExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ReRunAsAdministrator" Executed="ReRunAsAdministratorExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.CreateDirectory" Executed="CreateDirectoryExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.CheckForUpdates" Executed="CheckForUpdatesExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ModifySelection" Executed="ModifySelectionExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.MoveFiles" Executed="MoveFilesExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.CreateFile" Executed="CreateFileExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.GetChecksums" Executed="GetCheckSumExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ClearDb" Executed="ClearDbExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ChangeAccentColor" Executed="ChangeAccentColorExecuted" CanExecute="DefaultCommands_CanExecute"/>
        <CommandBinding Command="local:Commands.ChangeTheme" Executed="ChangeThemeExecuted" CanExecute="DefaultCommands_CanExecute"/>
    </Window.CommandBindings>

    <Window.Resources>
        <converters:FileNameToIconConverter x:Key="FileNameToIconConverter"/>
        <converters:FileLengthToNormalConverter x:Key="FileLengthConverter"/>
        <converters:ReadedFilesToColorConverter x:Key="FilesToColorConverter"/>
        <Style x:Key="GridViewColumnHeaderMetroStyle" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}" TargetType="GridViewColumnHeader">
            <Setter Property="Background" Value="{DynamicResource TransparentBrush}"></Setter>
            <Setter Property="Padding" Value="5"></Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Border BorderBrush="LightGray" BorderThickness="1">
                                <TextBlock Padding="5, 5, 5, 5" HorizontalAlignment="Stretch"
                                                                               VerticalAlignment="Center" TextAlignment="Center" Text="{TemplateBinding Content}"></TextBlock>
                            </Border>

                            <Thumb Grid.Column="1" x:Name="PART_HeaderGripper" HorizontalAlignment="Right"
                        Width="2" BorderThickness="1"
                        BorderBrush="{Binding VerticalGridLinesBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}"
                        Cursor="SizeWE"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Border BorderBrush="Black" BorderThickness="1">
                                        <TextBlock Padding="5, 5, 5, 5" HorizontalAlignment="Stretch"
                                                                               VerticalAlignment="Center" TextAlignment="Center" Text="{TemplateBinding Content}"></TextBlock>
                                    </Border>

                                    <Thumb Grid.Column="1" x:Name="PART_HeaderGripper" HorizontalAlignment="Right"
                        Width="2" BorderThickness="1"
                        BorderBrush="{Binding VerticalGridLinesBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}"
                        Cursor="SizeWE"/>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
        <ControlTemplate x:Key="AccentColorsMenuItem" TargetType="{x:Type MenuItem}">
            <Border BorderThickness="1" Name="MenuItemBorder"  BorderBrush="Black"
                                                                Background="{TemplateBinding Background}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="35"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="35"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Name="CheckMark" HorizontalAlignment="Center" VerticalAlignment="Center"
                               Foreground="{TemplateBinding Foreground}"
                               FontFamily="{StaticResource FontAwesome}" Text="&#xf00c;" Visibility="Hidden"/>
                    <ContentPresenter Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5" ContentSource="Header">
                        <TextBlock.Foreground>
                            <TemplateBinding Property="Foreground" ></TemplateBinding>
                        </TextBlock.Foreground>
                    </ContentPresenter>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsChecked" Value="True">
                    <Setter TargetName="CheckMark" Property="Visibility" Value="Visible"/>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter TargetName="MenuItemBorder" Property="BorderBrush" Value="{x:Static metro:Manager.DefaultContrastBrush}"></Setter>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Window.Resources>
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition MaxHeight="40"></RowDefinition>
            <RowDefinition MaxHeight="40"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="20"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Menu>
                <MenuItem Header="{DynamicResource MwFileConMehuHeader}" FontFamily="{StaticResource FontAwesome}" >
                    <MenuItem Header="{DynamicResource MwFileConMenuRunAsAdmin}" Command="local:Commands.ReRunAsAdministrator">
                        <MenuItem.Style>
                            <Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
                                <Setter Property="FontFamily" Value="{StaticResource FontAwesome}"></Setter>
                                <Setter Property="IsEnabled" Value="True"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding Path=IsRunningWithAdminRights, ElementName=MainWindowX}" Value="True">
                                        <Setter Property="IsEnabled" Value="False"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </MenuItem.Style>
                    </MenuItem>
                    <MenuItem Header="{DynamicResource MwFileConMenuLanguage}" x:Name="LanguageMenu"></MenuItem>
                    <MenuItem Header="{DynamicResource MwFileConMenuExit}" Command="local:Commands.Exit"></MenuItem>
                </MenuItem>
                <MenuItem Header="{DynamicResource MwFileConMenuEdit}" FontFamily="{StaticResource FontAwesome}">
                    <MenuItem Header="{DynamicResource MwFileConMenuEditSelectAll}" Command="local:Commands.ModifySelection" CommandParameter="SelectAll"/>
                    <MenuItem Header="{DynamicResource MwFileConMenuEditInvertSelection}" Command="local:Commands.ModifySelection" CommandParameter="Invert"/>
                </MenuItem>
                <MenuItem Header="{DynamicResource MwSettingsConMenuHeader}" FontFamily="{StaticResource FontAwesome}">
                    <MenuItem Name="ThemesMenu" Header="{DynamicResource MwSettingsConMenuTheme}" SubmenuOpened="MenuItem_OnSubmenuOpened">
                        <MenuItem Header="{DynamicResource MwSettingsConMenuThemeLight}" Tag="Light" Command="local:Commands.ChangeTheme" CommandParameter="light"/>
                        <MenuItem Header="{DynamicResource MwSettingsConMenuThemeDark}" Tag="Dark" Command="local:Commands.ChangeTheme" CommandParameter="dark"/>
                    </MenuItem>
                    <MenuItem Name="ColorsMenu" Header="{DynamicResource MwSettingsConMenuAccentColors}" SubmenuOpened="ColorsMenu_OnSubmenuOpened">
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorBlue}" Background="{x:Static metro:AccentBrushes.Blue}"
                                  Foreground="{x:Static metro:Manager.DefaultContrastBrush}" 
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Blue"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorBrown}" Background="{x:Static metro:AccentBrushes.Brown}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Brown"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorGreen}" Background="{x:Static metro:AccentBrushes.Green}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Green"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorLime}" Background="{x:Static metro:AccentBrushes.Lime}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Lime"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorMagenta}" Background="{x:Static metro:AccentBrushes.Magenta}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Magenta"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorMango}" Background="{x:Static metro:AccentBrushes.Mango}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Mango"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorOrange}" Background="{x:Static metro:AccentBrushes.Orange}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Orange"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorPink}" Background="{x:Static metro:AccentBrushes.Pink}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Pink"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorPurple}" Background="{x:Static metro:AccentBrushes.Purple}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Purple"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorRed}" Background="{x:Static metro:AccentBrushes.Red}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Red"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorRose}" Background="{x:Static metro:AccentBrushes.Rose}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Rose"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorViolet}" Background="{x:Static metro:AccentBrushes.Violet}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Violet"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorViridian}" Background="{x:Static metro:AccentBrushes.Viridian}" Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Viridian"
                                  />
                        <MenuItem Header="{DynamicResource MwSettingsConMenuColorSky}" Background="{x:Static metro:AccentBrushes.Sky}"
                                  Foreground="{x:Static metro:Manager.DefaultContrastBrush}"
                                  Template="{StaticResource AccentColorsMenuItem}" Command="local:Commands.ChangeAccentColor" CommandParameter="Sky"
                                  />
                    </MenuItem>
                    <MenuItem Header="{DynamicResource MwSettingsConMenuClearDb}" Command="local:Commands.ClearDb"/>
                </MenuItem>
                <MenuItem Header="{DynamicResource MwHelpConMenuHeader}" FontFamily="{StaticResource FontAwesome}" >
                    <MenuItem Header="{DynamicResource MwHelpConMenuUpdates}" Command="local:Commands.CheckForUpdates"></MenuItem>
                    <MenuItem Header="{DynamicResource MwHelpConMenuAbout}" Command="local:Commands.AboutDialog"></MenuItem>
                </MenuItem>
            </Menu>
        </Grid>

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <StackPanel Orientation="Horizontal">
                    <ComboBox Name="CbDrives" Width="60" Margin="5, 0, 0, 0" SelectionChanged="CbDrives_OnSelectionChanged" Height="30" DropDownOpened="CbDrives_OnDropDownOpened"></ComboBox>
                    <Button Name="BtnDiveBack" Command="Backspace" Width="70" Margin="10, 0, 0, 0" Height="30"
                            FontFamily="{StaticResource FontAwesome}" Content="{DynamicResource MwBtnDiveBack}">
                        <Button.ToolTip>
                            <ToolTip>
                                <TextBlock>
                                    <Run FontFamily="{StaticResource FontAwesome}" Text="{DynamicResource MwBtnDiveBack}"></Run>
                                    <Run Text=" ("></Run>
                                    <Run Text="{DynamicResource MwBtnDiveBackKeys}"></Run>
                                    <Run Text=")"></Run>
                                </TextBlock>
                            </ToolTip>
                        </Button.ToolTip>
                    </Button>
                    <Button Name="BtnDiveForward" Command="BrowseForward" Width="Auto" Height="30" Margin="10, 0, 0, 0" 
                            FontFamily="{StaticResource FontAwesome}" Content="{DynamicResource MwBtnDiveForward}">
                        <Button.ToolTip>
                            <ToolTip>
                                <TextBlock>
                                    <Run FontFamily="{StaticResource FontAwesome}" Text="{DynamicResource MwBtnDiveForward}"></Run>
                                    <Run Text=" ("></Run>
                                    <Run Text="{DynamicResource MwBtnDiveForwardKeys}"></Run>
                                    <Run Text=")"></Run>
                                </TextBlock>
                            </ToolTip>
                        </Button.ToolTip>
                    </Button>
                </StackPanel>
            </Grid>
            <TextBox Grid.Column="1" Grid.Row="0" Margin="10, 0, 0, 0" Name="TbSearchInput" Text="{DynamicResource MwTbSearchInputText}"
                     ToolTip="{DynamicResource MwTbSearchInputTooltip}" Width="Auto" AutoWordSelection="True" Height="30" KeyUp="TbSearchInput_OnKeyUp">
            </TextBox>
            <Button Grid.Column="2" Grid.Row="0" Name="BtnSearch" Width="80" Margin="10, 0, 5, 0" Click="BtnSearch_OnClick" Height="30" FontFamily="{StaticResource FontAwesome}" Content="{DynamicResource MwBtnSearch}"></Button>
        </Grid>

        <Grid Grid.Row="2">
            <ListView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="ListViewExplorer"
                      MouseDoubleClick="ListViewExplorer_OnMouseDoubleClick" Focusable="True" DataContext="{x:Type io:FileSystemInfo}"
                      behaviours:GridViewColumnResize.Enabled="True">
                <ListView.InputBindings>
                    <KeyBinding Command="Open" Key="Enter"></KeyBinding>
                    <KeyBinding Command="Backspace" Key="Back"></KeyBinding>
                    <KeyBinding Command="BrowseForward" Key="Right" Modifiers="Alt"></KeyBinding>
                    <KeyBinding x:Name="KeyBind" Command="Backspace" Key="Left" Modifiers="Alt"></KeyBinding>
                </ListView.InputBindings>
                <ListView.ContextMenu>
                    <ContextMenu x:Name="MainLvContextMenu">
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuOpen}" Command="Open">
                        </MenuItem>
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuShowInExplorer}" Command="local:Commands.ShowInExplorer"/>
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuChecksumHeader}">
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuChecksumMd5}" Command="local:Commands.GetChecksums" CommandParameter="md5"/>
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuChecksumSha1}" Command="local:Commands.GetChecksums" CommandParameter="sha1"/>
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuChecksumSha256}" Command="local:Commands.GetChecksums" CommandParameter="sha256"/>
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuChecksumSha512}" Command="local:Commands.GetChecksums" CommandParameter="sha512"/>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuRename}" Command="local:Commands.Rename"/>
                        <Separator />
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuMove}" Command="local:Commands.MoveFiles"/>
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuCopyTo}" Command="local:Commands.CopyTo"/>
                        <Separator />
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuCreateHeader}">
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuCreateDir}">
                                <MenuItem x:Name="CreateDirHereMenuItem" Header="{DynamicResource MwMainLvContextMenuCreateHere}" Command="local:Commands.CreateDirectory"
                                          CommandParameter="0"></MenuItem>
                                <MenuItem x:Name="CreateDirInsideMenuItem" Header="{DynamicResource MwMainLvContextMenuCreateInside}" Command="local:Commands.CreateDirectory"
                                          CommandParameter="1">
                                </MenuItem>
                            </MenuItem>
                            <MenuItem Header="{DynamicResource MwMainLvContextMenuCreateFile}">
                                <MenuItem x:Name="CreateFileHereMenuItem" Command="local:Commands.CreateFile" 
                                              Header="{DynamicResource MwMainLvContextMenuCreateHere}" CommandParameter="0"/>
                                <MenuItem x:Name="CreateFileInsideMenuItem" Command="local:Commands.CreateFile" 
                                              Header="{DynamicResource MwMainLvContextMenuCreateInside}" CommandParameter="1"/>
                            </MenuItem>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuRemove}" Command="local:Commands.Remove"></MenuItem>
                        <Separator />
                        <MenuItem Header="{DynamicResource MwMainLvContextMenuProperties}" Command="local:Commands.PropertiesDialog"></MenuItem>
                    </ContextMenu>
                </ListView.ContextMenu>
                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListViewItem}">
                                    <Border CornerRadius="2" SnapsToDevicePixels="True"
                                                    BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                                                    Background="{TemplateBinding Background}">
                                        <Grid>
                                            <GridViewRowPresenter/>
                                        </Grid>
                                    </Border>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ListViewItem}">
                                            <Border CornerRadius="2" SnapsToDevicePixels="True"
                                                    BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
                                                    Background="{TemplateBinding Background}">
                                                <Grid>
                                                    <GridViewRowPresenter/>
                                                </Grid>
                                            </Border>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="ToolTip">
                                    <Setter.Value>
                                        <ToolTip>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock >
                                            <Run Text="{DynamicResource MwMainLvTooltipType}"></Run>
                                            <Run Text=": "></Run>
                                            <Run Text="{Binding Path=Extension, Mode=OneWay}"></Run>
                                                </TextBlock>
                                                <TextBlock>
                                            <Run Text="{DynamicResource MwMainLvTooltipSize}"/>
                                            <Run Text=": "/>
                                            <Run Text="{Binding Path=Length, Mode=OneWay, Converter={StaticResource FileLengthConverter}}"/>
                                                </TextBlock>
                                                <TextBlock>
                                            <Run Text="{DynamicResource MwMainLvtooltipChangeDate}"/>
                                            <Run Text=": "/>
                                            <Run Text="{Binding Path=LastWriteTime, Mode=OneWay, StringFormat={x:Static util:Constants.DateTimeFormat}}"/>
                                                </TextBlock>
                                            </StackPanel>
                                        </ToolTip>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Background" Value="{Binding ElementName=MainWindowX, Path=GetCurrentAccentBrush}"></Setter>
                                <Setter Property="Foreground" Value="{x:Static metro:Manager.DefaultContrastBrush}"></Setter>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter Property="Background" Value="{Binding ElementName=MainWindowX, Path=GetCurrentAccentBrush}"></Setter>
                                <Setter Property="Foreground" Value="{x:Static metro:Manager.DefaultContrastBrush}"></Setter>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.View>
                    <GridView AllowsColumnReorder="False" ColumnHeaderContainerStyle="{StaticResource GridViewColumnHeaderMetroStyle}">
                        <GridViewColumn behaviours:GridViewColumnResize.Width="*">
                            <GridViewColumn.Header>
                                <GridViewColumnHeader Name="NameColumn" DataContext="{x:Type io:FileSystemInfo}" 
                                                      Foreground="{Binding ElementName=MainWindowX, Path=GetCurrentContrastBrush, UpdateSourceTrigger=Explicit}"
                                                      Content="{DynamicResource MwMainLvTooltipName}"></GridViewColumnHeader>
                            </GridViewColumn.Header>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock FontFamily="{StaticResource FontAwesome}" FontSize="20" Foreground="SlateGray" Margin="0, 0, 10, 0" 
                                                        Text="{Binding Path=FullName, Converter={StaticResource FileNameToIconConverter}}" VerticalAlignment="Center"/>
                                        <TextBlock FontSize="16" Foreground="{Binding Path=FullName, Converter={StaticResource FilesToColorConverter}}" 
                                                   Text="{Binding Name}">
                                        </TextBlock>
                                    </StackPanel>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn  DisplayMemberBinding="{Binding Path=LastWriteTime, Mode=OneWay,
                            StringFormat={x:Static util:Constants.DateTimeFormat}}">
                            <GridViewColumn.Header>
                                <GridViewColumnHeader Name="DateColumn" Content="{DynamicResource MwMainLvtooltipChangeDate}" Foreground="{Binding ElementName=MainWindowX, Path=GetCurrentContrastBrush, UpdateSourceTrigger=Explicit}"/>
                            </GridViewColumn.Header>
                        </GridViewColumn>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Length, Mode=OneWay,
                            Converter={StaticResource FileLengthConverter}}" Width="70">
                            <GridViewColumn.Header>
                                <GridViewColumnHeader Name="SizeColumn" Content="{DynamicResource MwMainLvTooltipSize}" Foreground="{Binding ElementName=MainWindowX, Path=GetCurrentContrastBrush, UpdateSourceTrigger=Explicit}"/>
                            </GridViewColumn.Header>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
            <Popup Name="SearchPopup" StaysOpen="False" PopupAnimation="Slide" Placement="Center" AllowsTransparency="True"
                   MouseEnter="Popup_OnMouseEnter" MouseLeftButtonUp="PopupLeftMouseButtonUp">
                <Border BorderBrush="DarkBlue" BorderThickness="2" Background="White">
                    <StackPanel Margin="5">
                        <StackPanel.Resources>
                            <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                <Setter Property="Foreground" Value="Black"/>
                            </Style>
                        </StackPanel.Resources>
                        <TextBlock Margin="5" FontFamily="{StaticResource FontAwesome}"  HorizontalAlignment="Center" Text="{DynamicResource MwSearchPopupFirstTextBlock}"></TextBlock>
                        <TextBlock Margin="5" FontFamily="{StaticResource FontAwesome}"  HorizontalAlignment="Center">
                            <Run Text="{DynamicResource MwSearchPopupSecondTextBlock}"></Run>
                            <Run FontWeight="Bold" Text="{DynamicResource MwSearchPopupSecondTextBlockBoldPart}"></Run>
                        </TextBlock>
                    </StackPanel>
                </Border>
            </Popup>
            <Popup Name="ErrorPopup" StaysOpen="False" PopupAnimation="Slide" Placement="Center" AllowsTransparency="True"
                   MouseEnter="Popup_OnMouseEnter" MouseLeftButtonUp="PopupLeftMouseButtonUp">
                <Border BorderBrush="DarkRed" BorderThickness="2" Background="White">
                    <StackPanel Margin="5">
                        <StackPanel.Resources>
                            <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                <Setter Property="Foreground" Value="Black"/>
                            </Style>
                        </StackPanel.Resources>
                        <TextBlock Margin="5" FontFamily="{StaticResource FontAwesome}"  HorizontalAlignment="Center" Text="{DynamicResource MwErrorPopupTextBlock}"></TextBlock>
                    </StackPanel>
                </Border>
            </Popup>
            <Popup Name="CustomErrorPopup" StaysOpen="False" PopupAnimation="Slide" Placement="Center" AllowsTransparency="True"
                   MouseEnter="Popup_OnMouseEnter" MouseLeftButtonUp="PopupLeftMouseButtonUp">
                <Border BorderBrush="Blue" BorderThickness="2" Background="White">
                    <StackPanel Margin="5">
                        <StackPanel.Resources>
                            <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
                                <Setter Property="Foreground" Value="Black"/>
                            </Style>
                        </StackPanel.Resources>
                        <TextBlock Margin="5" FontFamily="{StaticResource FontAwesome}"  HorizontalAlignment="Center" Text="{DynamicResource MwCustomErrorPopupFirstTextBlock}"></TextBlock>
                        <TextBlock Name="CustomErrorPopupTextBlock" FontFamily="{StaticResource FontAwesome}"  HorizontalAlignment="Center"></TextBlock>
                    </StackPanel>
                </Border>
            </Popup>
        </Grid>

        <Grid Grid.Row="3">
            <DockPanel>
                <ProgressBar Name="PbVisualization" IsIndeterminate="True" Visibility="Hidden" Height="18"></ProgressBar>
            </DockPanel>
        </Grid>
    </Grid>
</metro:Window>
